package com.pansky.crm.controller.system;

import com.pansky.crm.annotation.OperateLog;
import com.pansky.crm.common.mybatisplus.ApiResult;
import com.pansky.crm.common.mybatisplus.ResultPageDto;
import com.pansky.crm.entity.UserOperateLog;
import com.pansky.crm.entity.bo.page.UserOperateLogPageBo;
import com.pansky.crm.service.UserOperateLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：zhouzhiyong
 * @date ：Created in 2021/3/1 15:10
 * @description：操作日志
 */
@RestController
@Api(tags = {"管理端-用户操作日志"})
@OperateLog
@RequestMapping("/userOperateLog")
public class UserOperateLogController {

    @Autowired
    private UserOperateLogService userOperateLogService;

    @ApiOperation(value = "分页查询操作日志",notes = "分页查询操作日志")
    @PostMapping("/page/query")
    public ApiResult<ResultPageDto> queryByPage(@RequestBody UserOperateLogPageBo queryDTO) {
        return userOperateLogService.queryByPage(queryDTO);
    }

    @ApiOperation(value="删除操作日志",notes = "删除操作日志")
    @GetMapping("/delete")
    public ApiResult<Boolean> delete(@RequestParam Integer id){
        return ApiResult.ok(userOperateLogService.removeById(id));
    }


    @ApiOperation(value="操作日志详情",notes = "操作日志详情")
    @GetMapping("/detail")
    public ApiResult<UserOperateLog> detail(@RequestParam Integer id){
        return ApiResult.ok(userOperateLogService.getById(id));
    }
}
